package com.xxx.modules.controller;;
import com.xxx.modules.service.LogService;
import com.xxx.modules.entity.Log;
import com.xxx.modules.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import com.github.pagehelper.PageInfo;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.xxx.modules.utils.Result;
import com.xxx.modules.utils.ResultUtil;
import com.xxx.modules.utils.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
 * 维修记录
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2024-03-30
 */
@RestController
@RequestMapping("/common/log")
@Api(tags="维修记录")
public class LogController {
    @Autowired
    private LogService logService;

    /**
    *  获取所有维修记录
    * @param pageNum
    * @param pageSize
    * @param log
    * @return
    */

    @GetMapping("/getLogList")
    @ApiOperation("获取所有维修记录")
    public Result getLogList(Log log, @RequestParam(value="pageNum",defaultValue = "1") Integer pageNum,
                                      @RequestParam(value="pageSize",defaultValue = "10") Integer pageSize){
        return logService.selectLogList(log,pageNum,pageSize);
    }


    @GetMapping("/getLogInfo")
    @ApiOperation("根据id获取单个维修记录")
    public Result getLogInfo(Integer id){
        return logService.selectLogInfo(id);
    }

    /**
    * 保存维修记录
    * @param log
    * @return
    */
    @PostMapping("/saveLogInfo")
    @ApiOperation("保存维修记录")
    public Result saveLogInfo(@RequestBody Log log){
        return logService.saveLogInfo(log);
    }


    /**
     * 更新维修记录
     * @param log
     * @return
     */

    @PutMapping("/updateLogInfo")
    @ApiOperation("更新维修记录")
    public Result updateLogInfo(@RequestBody Log log){
        return logService.updateLogInfo(log);
    }

    /**
     * 根据id删除维修记录
     * @param id
     * @return
     */
    @DeleteMapping("/delLogInfo")
    @ApiOperation("根据id删除维修记录")
    public Result delLogInfo(Integer id){
        return logService.delLogInfo(id);
    }

    /**
     * 根据id集合批量删除维修记录
     * @param idList
     * @return
     */
    @DeleteMapping("/delBatchLogInfo")
    @ApiOperation("根据id集合批量删除维修记录")
    public Result delBatchLogInfo(String idList){
        return logService.delBatchLogInfo(idList);
    }










}